package manager;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.util.*;

import InterfazRemota.InterfazRemota;
import NegocioVO.*;

public class AdministradorLocal
{	
	private InterfazRemota ir;
	private static AdministradorLocal instancia;
	
	public static AdministradorLocal getInstancia()
	{
		if(instancia==null)
			instancia = new AdministradorLocal();
		return instancia;
	}
	
	private AdministradorLocal()
	{
		try {
			ir = (InterfazRemota) Naming.lookup("TPO_Restaurante");
			
			
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (RemoteException e) {
			e.printStackTrace();
		} catch (NotBoundException e) {
			e.printStackTrace();
		}
	}
	
	public  List<LocalVO> getLocales() {
		try {
			return ir.listarLocales();
		} catch (RemoteException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public  Integer getLocalId(String UserID,String PassWord) {
		try {
			return ir.BuscarLocalId(UserID, PassWord);
		} catch (RemoteException e) {
			e.printStackTrace();
		}
		return null;
	}
}
